package com.yiwei.zhh.api.requestInfo;

import com.yiwei.zhh.api.Api;
import com.yiwei.zhh.api.bean.NewBeginApplyBean;
import com.yiwei.zhh.api.bean.NewV2BeginApplyBean;
import com.yiwei.zhh.api.callback.BeginApplyContract;
import com.yiwei.zhh.api.callback.BeginApplyV2Contract;
import com.yiwei.zhh.util.Network;
import com.yiwei.zhh.util.RxLifeUtil;
import com.yiwei.zhh.util.ToastUtil;

/**
 * Created by Administrator on 2017/5/14.
 */

public class BeginApplyV2Request extends BaseRequest<BeginApplyV2Contract.View> implements BeginApplyV2Contract.Presenter<BeginApplyV2Contract.View> {

    public static BeginApplyV2Request create() {
        return new BeginApplyV2Request();
    }




    @Override
    public void getDealTypeInfo() {
        if (!Network.checkNetwork(BaseContext)) {
            ToastUtil.makeText(BaseContext, networkFail).show();
            return;
        }
        mView.onRequestStart();
        Api.api_service.getDealTypes().compose(RxLifeUtil.checkOn(BaseContext)).
                doFinally(() -> {
                    try {
                        mView.complete();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    mView.getDealTypeInfoSuccess(result);
                });
    }

}
